/*
 *
 * Saturn Framework Co.Limt
 * Copyright (c) 2012-2019 tanks, Inc. All rights reserved.
 */
 
package com.saturn.config.server.service.impl;

import java.time.LocalDateTime;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.saturn.config.server.base.entity.SysUser;
import com.saturn.config.server.base.mapper.SysUserMapper;
import com.saturn.config.server.service.SysUserService;

/**
 * <dl>
 *    <dt><b>Title:</b></dt>
 *    <dd>
 *    	none
 *    </dd>
 *    <dt><b>Description:</b></dt>
 *    <dd>
 *    	<p>系统用户表
 *    </dd>
 *
 * @author tanks
 * @date 2019-07-08 15:58:43
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {

	@Override
	@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
	public int deleteRecords(List<String> userIds) {
		return this.baseMapper.deleteBatchIds(userIds);
	}

	@Override
	public int batchSaveRecords(List<SysUser> sysUsers) throws Exception {
		int count = 0;
		for(SysUser sysUser:sysUsers) {
			sysUser.setUpdateTime(LocalDateTime.now());
			this.baseMapper.updateById(sysUser);
			count++;
		}
		return count;
	}

}
